#include "storageedit.h"
#include "ui_storageedit.h"
#include <QToolButton>
StorageEdit::StorageEdit(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::StorageEdit)
{
    ui->setupUi(this);

}
void StorageEdit::update(Storage storage){
    ui->image->showURLImage(storage.pic);
    ui->name->setText(storage.name);
    ui->alias->setText(storage.alias);
    ui->info->setText(storage.info);
    ui->amount->setText(QString::number(storage.amount));
    connect(ui->confirm,&QToolButton::clicked,[=](){
        emit confirm(ui->amount->text().toInt());
        this->close();
    });
    connect(ui->cancel,&QToolButton::clicked,[=](){
        this->close();
    });
    this->adjustSize();
}

StorageEdit::~StorageEdit()
{
    delete ui;
}
